local extension = Package("rfenghou_qin")
extension.extensionName = "aaa_fenghou"

local U = require "packages/utility/utility"
local RUtil = require "packages/aaa_fenghou/utility/rfenghou_util"

Fk:loadTranslationTable{
  ["rfenghou_qin"] = "还秦",
}



local yingziying = General(extension, "rfenghou__yingziying", "qin", 3)
local linggao = fk.CreateTriggerSkill{
  name = "rfenghou__linggao",
  mute = true,
  events = {fk.GameStart, fk.DamageInflicted},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self) then
      if event == fk.GameStart then
        return true
      end
    end
    return target == player and player:hasSkill(self)
  end,
  on_cost = function (self, event, target, player, data)
    if event == fk.GameStart then
      return true
    else
      local use = player.room:askForUseCard(player, self.name, "fire_attack,lightning,iron_chain",
        "#rfenghou__linggao-invoke", true, {exclusive_targets = {player.id}})
      if use then
        self.cost_data = use
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.GameStart then
      local cards = {}
      for _, name in ipairs({"fire_attack", "lightning", "iron_chain"}) do
        table.insertTable(cards, room:getCardsFromPileByRule(name, 1, "drawPile"))
      end
      if #cards > 0 then
        player:broadcastSkillInvoke(self.name)
        room:notifySkillInvoked(player, self.name, "drawcard")
        room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, self.name, nil, true, player.id)
      end
    else
      player:broadcastSkillInvoke(self.name)
      room:notifySkillInvoked(player, self.name, "defensive")
      room:useCard(self.cost_data)
      return true
    end
  end,
}
local chengxia = fk.CreateViewAsSkill{
  name = "rfenghou__chengxia",
  anim_type = "offensive",
  pattern = "slash,fire_attack,lightning",  --仅留三个牌名以供回合外触发使用
  prompt = function (self)
    return "#rfenghou__chengxia:::"..Self:getMark(self.name)
  end,
  card_filter = function(self, to_select, selected)
    return #selected == 0
  end,
  view_as = function(self, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard(Self:getMark(self.name))
    card.skillName = self.name
    card:addSubcard(cards[1])
    return card
  end,
  enabled_at_play = function(self, player)
    return player:getMark(self.name) ~= 0 and player:getMark("rfenghou__chengxia_invoke") > 0
  end,
  enabled_at_response = function (self, player, response)
    return not response and player:getMark(self.name) ~= 0 and player:getMark("rfenghou__chengxia_invoke") > 0 and
      ((Fk.currentResponsePattern == nil and player:canUse(Fk:cloneCard(player:getMark(self.name)))) or
      (Fk.currentResponsePattern and Exppattern:Parse(Fk.currentResponsePattern):match(Fk:cloneCard(player:getMark(self.name)))))
  end,
}
local chengxia_trigger = fk.CreateTriggerSkill{
  name = "#rfenghou__chengxia_trigger",
  mute = true,
  main_skill = chengxia,
  events = {fk.AfterCardsMove, fk.PreCardEffect, fk.AfterCardTargetDeclared},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(chengxia) then
      if event == fk.AfterCardsMove then
        local cards = {}
        for _, move in ipairs(data) do
          if move.from == player.id then
            for _, info in ipairs(move.moveInfo) do
              if info.fromArea == Card.PlayerJudge and
                info.extra_data and info.extra_data.rfenghou__chengxia == player.id and
                not table.contains(player:getCardIds("h"), info.cardId) then
                table.insertIfNeed(cards, info.cardId)
              end
            end
          end
        end
        if #cards > 0 then
          self.cost_data = cards
          return true
        end
      elseif event == fk.PreCardEffect then  --FIXME: 伪实现以获得转化闪电
        if data.to == player.id and data.card.name == "lightning" and data.card:isVirtual() and #data.card.subcards > 0 then
          self.cost_data = data.card.subcards
          return true
        end
      end
    end
    if event == fk.AfterCardTargetDeclared then
      return target == player and table.contains(data.card.skillNames, "rfenghou__chengxia") and
        #player.room:getUseExtraTargets(data) > 0 and
        table.find(player.room.alive_players, function (p)
          return p:hasDelayedTrick("lightning")
        end)
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    if event == fk.AfterCardsMove or event == fk.PreCardEffect then
      player:broadcastSkillInvoke("rfenghou__chengxia")
      room:notifySkillInvoked(player, "rfenghou__chengxia", "drawcard")
      room:delay(600)
      room:moveCardTo(self.cost_data, Card.PlayerHand, player, fk.ReasonPrey, "rfenghou__chengxia", nil, true, player.id)
    else
      local to = room:askForChoosePlayers(player, room:getUseExtraTargets(data), 1, 1,
        "#rfenghou__chengxia-choose:::"..data.card:toLogString(), "rfenghou__chengxia", true)
      if #to > 0 then
        table.insert(data.tos, to)
      end
    end
  end,

  refresh_events = {fk.BeforeCardsMove, fk.StartPlayCard, fk.AskForCardUse, fk.Damaged, fk.EventAcquireSkill},
  can_refresh = function(self, event, target, player, data)
    if event == fk.BeforeCardsMove then
      return player:hasSkill(chengxia, true) and player:hasDelayedTrick("lightning")
    elseif event == fk.StartPlayCard or event == fk.AskForCardUse then
      return target == player and player:hasSkill(chengxia)
    elseif event == fk.Damaged then
      return target == player and player:hasSkill(chengxia, true) and data.card
    elseif event == fk.EventAcquireSkill then
      return target == player and data == chengxia
    end
  end,
  on_refresh = function(self, event, target, player, data)
    if event == fk.BeforeCardsMove then
      for _, move in ipairs(data) do
        if move.from == player.id then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerJudge and
              (Fk:getCardById(info.cardId).trueName == "lightning" or
              (player:getVirualEquip(info.cardId) and player:getVirualEquip(info.cardId).trueName == "lightning")) then
                --转化闪电在判定阶段移动到处理区的移动事件中card信息完全丢失
              info.extra_data = info.extra_data or {}
              info.extra_data.rfenghou__chengxia = player.id
            end
          end
        end
      end
    elseif event == fk.StartPlayCard or event == fk.AskForCardUse then
      local room = player.room
      local phase_event = room.logic:getCurrentEvent():findParent(GameEvent.Phase, true)
      if phase_event == nil or phase_event.data[2] ~= Player.Play then
        room:setPlayerMark(player, "rfenghou__chengxia_invoke", 0)
        return
      end
      if #room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
        local use = e.data[1]
        return use.from == target.id
      end, Player.HistoryPhase) > 0 then
        room:setPlayerMark(player, "rfenghou__chengxia_invoke", 0)
        return
      end
      room:setPlayerMark(player, "rfenghou__chengxia_invoke", 1)
    elseif event == fk.Damaged then
      player.room:setPlayerMark(player, "rfenghou__chengxia", data.card.name)
    elseif event == fk.EventAcquireSkill then
      local room = player.room
      local name = 0
      room.logic:getActualDamageEvents(1, function(e)
        local damage = e.data[1]
        if damage.to == player and damage.card then
          name = damage.card.name
          return true
        end
      end, Player.HistoryGame, 1)
      room:setPlayerMark(player, "rfenghou__chengxia", name)
    end
  end,
}
chengxia:addRelatedSkill(chengxia_trigger)
yingziying:addSkill(linggao)
yingziying:addSkill(chengxia)
Fk:loadTranslationTable{
  ["rfenghou__yingziying"] = "嬴子婴",
  ["#rfenghou__yingziying"] = "落暮回钟",
  ["designer:rfenghou__yingziying"] = "慰酒",
  ["illustrator:rfenghou__yingziying"] = "漂泊诗人",

  ["rfenghou__linggao"] = "陵高",
  [":rfenghou__linggao"] = "游戏开始时，将【闪电】【火攻】【铁索连环】各一张加入手牌。当你受到伤害时，你可以对你使用上述一张同名牌，防止此伤害。",
  ["rfenghou__chengxia"] = "城狭",
  [":rfenghou__chengxia"] = "一名角色的出牌阶段，若你此阶段未使用过牌，你可以将一张牌当上次对你造成伤害的牌使用，若场上有【闪电】，此牌可以额外"..
  "指定一个目标。当【闪电】离开你的判定区后，你获得之。",
  ["#rfenghou__linggao-invoke"] = "陵高：你可以对自己使用一张【闪电】【火攻】或【铁索连环】，防止你受到的伤害",
  ["#rfenghou__chengxia"] = "城狭：你可以将一张牌当【%arg】使用",
  ["#rfenghou__chengxia_trigger"] = "城狭",
  ["#rfenghou__chengxia-choose"] = "城狭：是否为%arg额外指定一个目标？",
}

local wangmeng = General(extension, "rfenghou__wangmeng", "qin", 3)
local wucai = fk.CreateViewAsSkill{
  name = "rfenghou__wucai",
  pattern = ".|.|.|.|.|basic;nullification",
  prompt = "#rfenghou__wucai",
  interaction = function(self)
    local all_names = U.getAllCardNames("b")
    table.insert(all_names, "nullification")
    local names = U.getViewAsCardNames(Self, self.name, all_names, Self:getCardIds("h"))
    if #names > 0 then
      return U.CardNameBox { choices = names, all_choices = all_names }
    end
  end,
  card_filter = Util.FalseFunc,
  view_as = function(self, cards)
    if not self.interaction.data then return end
    local card = Fk:cloneCard(self.interaction.data)
    card.skillName = self.name
    card:addSubcards(Self:getCardIds("h"))
    return card
  end,
  after_use = function (self, player, use)
    if not player.dead then
      player.room:setPlayerMark(player, "@@rfenghou__wucai", use.card.trueName)
      local types = {}
      for _, id in ipairs(use.card.subcards) do
        table.insertIfNeed(types, Fk:getCardById(id).type)
      end
      player:drawCards(#types, self.name)
    end
  end,
  enabled_at_play = function (self, player)
    return not player:isKongcheng() and player:getMark("@@rfenghou__wucai") == 0
  end,
  enabled_at_response = function (self, player, response)
    return not response and not player:isKongcheng() and player:getMark("@@rfenghou__wucai") == 0
  end,
}
local wucai_trigger = fk.CreateTriggerSkill{
  name = "#rfenghou__wucai",

  refresh_events = {fk.AfterCardUseDeclared},
  can_refresh = function(self, event, target, player, data)
    return player:getMark("@@rfenghou__wucai") == data.card.trueName
  end,
  on_cost = Util.TrueFunc,
  on_refresh = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "@@rfenghou__wucai", 0)
  end,
}
local youqin = fk.CreateTriggerSkill{
  name = "rfenghou__youqin",
  anim_type = "support",
  events = {fk.EventPhaseEnd},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and target.phase == Player.Discard and not target.dead and
      #player.room.logic:getEventsOfScope(GameEvent.MoveCards, 1, function(e)
        for _, move in ipairs(e.data) do
          if move.from == target.id and move.moveReason == fk.ReasonDiscard then
            return true
          end
        end
      end, Player.HistoryPhase) == 0
  end,
  on_cost = function(self, event, target, player, data)
    if player.room:askForSkillInvoke(player, self.name, nil, "#rfenghou__youqin-invoke::"..target.id) then
      self.cost_data = {tos = {target.id}}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    target:drawCards(1, self.name)
  end,
}
wucai:addRelatedSkill(wucai_trigger)
wangmeng:addSkill(wucai)
wangmeng:addSkill(youqin)
Fk:loadTranslationTable{
  ["rfenghou__wangmeng"] = "王猛",
  ["#rfenghou__wangmeng"] = "清平执威",
  ["designer:rfenghou__wangmeng"] = "爱咋咋地",
  ["illustrator:rfenghou__wangmeng"] = "率土之滨",

  ["rfenghou__wucai"] = "武才",
  [":rfenghou__wucai"] = "你可以将所有手牌当任意基本牌或【无懈可击】使用，然后你摸X张牌（X为用以转化的类别数），此技能失效直到有角色使用同名牌。",
  ["rfenghou__youqin"] = "忧勤",
  [":rfenghou__youqin"] = "一名角色弃牌阶段结束时，若其未于此阶段内弃置牌，你可以令其摸一张牌。",
  ["#rfenghou__wucai"] = "武才：你可以将所有手牌当任意基本牌或【无懈可击】使用，然后摸其中类别数的牌",
  ["@@rfenghou__wucai"] = "武才失效",
  ["#rfenghou__youqin-invoke"] = "忧勤：是否令 %dest 摸一张牌？",
}

local fujian = General(extension, "rfenghou__fujian", "qin", 4)
local hezhi = fk.CreateViewAsSkill{
  name = "rfenghou__hezhi",
  mute = true,
  prompt = "#rfenghou__hezhi",
  interaction = function(self)
    local all_names = {"hanqing__enemy_at_the_gates", "amazing_grace"}
    local names = U.getViewAsCardNames(Self, self.name, all_names)
    if #names > 0 then
      return U.CardNameBox { choices = names, all_choices = all_names }
    end
  end,
  card_filter = Util.FalseFunc,
  view_as = function(self, cards)
    if self.interaction.data == nil then return end
    local card = Fk:cloneCard(self.interaction.data)
    card.skillName = self.name
    return card
  end,
  before_use = function(self, player, use)
    local room = player.room
    player:broadcastSkillInvoke(self.name)
    if use.card.name == "hanqing__enemy_at_the_gates" then
      room:notifySkillInvoked(player, self.name, "offensive")
    else
      room:notifySkillInvoked(player, self.name, "support")
    end
  end,
  after_use = function (self, player, use)
    if not player.dead and not (use.extra_data and use.extra_data.rfenghou__hezhi) then
      local name = "amazing_grace"
      if use.card.name == "amazing_grace" then
        name = "hanqing__enemy_at_the_gates"
      end
      local card = Fk:cloneCard(name)
      card.skillName = "#rfenghou__hezhi_delay"
      if player:canUse(card) then
        U.askForUseVirtualCard(player.room, player, name, nil, "#rfenghou__hezhi_delay",
          "#rfenghou__hezhi-use:::"..name, false)
      end
    end
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
  end,
}
local hezhi_prohibit = fk.CreateProhibitSkill{
  name = "#rfenghou__hezhi_prohibit",
  is_prohibited = function(self, from, to, card)
    return card and table.contains(card.skillNames, "rfenghou__hezhi") and from == to
  end,
}
local hezhi_delay = fk.CreateTriggerSkill{
  name = "#rfenghou__hezhi_delay",
  mute = true,
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    local effect_event = player.room.logic:getCurrentEvent():findParent(GameEvent.CardEffect)  --兵临城下亮出牌是对于effect
    if effect_event then
      local use = effect_event.data[1]
      if table.contains(use.card.skillNames, "rfenghou__hezhi") and use.card.name == "hanqing__enemy_at_the_gates" and
        use.from == player.id and not player.dead and use.extra_data then
        for _, move in ipairs(data) do
          if move.toArea == Card.DiscardPile and move.moveReason == fk.ReasonPutIntoDiscardPile then
            for _, info in ipairs(move.moveInfo) do
              if info.fromArea == Card.Processing and table.contains(use.extra_data.HQenemy_at_the_gates, info.cardId) then
                return true
              end
            end
          end
        end
      end
    end
    local use_event = player.room.logic:getCurrentEvent():findParent(GameEvent.UseCard)  --五谷丰登亮出牌是对于use
    if use_event then
      local use = use_event.data[1]
      if table.contains(use.card.skillNames, "rfenghou__hezhi") and use.card.name == "amazing_grace" and
        use.from == player.id and not player.dead and use.extra_data then
        for _, move in ipairs(data) do
          if move.toArea == Card.DiscardPile and move.moveReason == fk.ReasonPutIntoDiscardPile then
            for _, info in ipairs(move.moveInfo) do
              if info.fromArea == Card.Processing and table.contains(use.extra_data.AGFilled, info.cardId) then
                return true
              end
            end
          end
        end
      end
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = {}
    local effect_event = room.logic:getCurrentEvent():findParent(GameEvent.CardEffect)
    if effect_event then
      local use = effect_event.data[1]
      if table.contains(use.card.skillNames, "rfenghou__hezhi") and use.card.name == "hanqing__enemy_at_the_gates" then
        for _, move in ipairs(data) do
          if move.toArea == Card.DiscardPile and move.moveReason == fk.ReasonPutIntoDiscardPile then
            for _, info in ipairs(move.moveInfo) do
              if info.fromArea == Card.Processing and table.contains(use.extra_data.HQenemy_at_the_gates, info.cardId) then
                table.insertIfNeed(cards, info.cardId)
              end
            end
          end
        end
      end
    end
    local use_event = room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
    if use_event then
      local use = use_event.data[1]
      if table.contains(use.card.skillNames, "rfenghou__hezhi") and use.card.name == "amazing_grace" then
        for _, move in ipairs(data) do
          if move.toArea == Card.DiscardPile and move.moveReason == fk.ReasonPutIntoDiscardPile then
            for _, info in ipairs(move.moveInfo) do
              if info.fromArea == Card.Processing and table.contains(use.extra_data.AGFilled, info.cardId) then
                table.insertIfNeed(cards, info.cardId)
              end
            end
          end
        end
      end
    end
    if #cards > 0 and use_event then
      local use = use_event.data[1]
      use.extra_data = use.extra_data or {}
      use.extra_data.rfenghou__hezhi = true
    end
    U.moveCardsHoldingAreaCheck(room, cards)
    if #cards > 0 then
      player:broadcastSkillInvoke("rfenghou__hezhi")
      room:notifySkillInvoked(player, "rfenghou__hezhi", "drawcard")
      player:throwAllCards("h")
      if not player.dead then
        cards = table.filter(cards, function (id)
          return table.contains(room.discard_pile, id)
        end)
        if #cards > 0 then
          room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, self.name, nil, true, player.id)
        end
      end
    end
  end,
}
local yingzhi = fk.CreateTriggerSkill{
  name = "rfenghou__yingzhi",
  anim_type = "control",
  events = {fk.TargetSpecified},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) and player:getHandcardNum() == player:getMaxCards() and
      (data.card.type == Card.TypeBasic or data.card:isCommonTrick()) and data.firstTarget and
      player:usedSkillTimes(self.name, Player.HistoryTurn) == 0 then
      local n = #AimGroup:getAllTargets(data.tos)
      return n > 1 or #player.room:getUseExtraTargets(data, false, true) >= n
    end
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player, "rfenghou__yingzhi-tmp", {AimGroup:getAllTargets(data.tos), room:getUseExtraTargets(data, false, true)})
    local success, dat = room:askForUseActiveSkill(player, "rfenghou__yingzhi_active",
      "#rfenghou__yingzhi-choose:::"..data.card:toLogString(), true, nil, false)
    room:setPlayerMark(player, "rfenghou__yingzhi-tmp", 0)
    if success and dat then
      self.cost_data = dat
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local tos = self.cost_data.targets
    player.room:sortPlayersByAction(tos)
    data.nullifiedTargets = data.nullifiedTargets or {}
    for _, id in ipairs(tos) do
      if table.contains(AimGroup:getAllTargets(data.tos), id) then
        table.insertIfNeed(data.nullifiedTargets, id)
      else
        TargetGroup:pushTargets(data.targetGroup, id)
      end
    end
  end,
}
local yingzhi_active = fk.CreateActiveSkill{
  name = "rfenghou__yingzhi_active",
  card_num = 0,
  min_target_num = 1,
  interaction = UI.ComboBox {choices = {"rfenghou__yingzhi1", "rfenghou__yingzhi2"}},
  card_filter = Util.FalseFunc,
  target_filter = function (self, to_select, selected)
    local n = #Self:getMark("rfenghou__yingzhi-tmp")[1]
    if self.interaction.data == "rfenghou__yingzhi1" then
      return #selected < n and table.contains(Self:getMark("rfenghou__yingzhi-tmp")[2], to_select)
    else
      return #selected < n // 2 and table.contains(Self:getMark("rfenghou__yingzhi-tmp")[1], to_select)
    end
  end,
  feasible = function (self, selected, selected_cards)
    if #selected > 0 then
      local n = #Self:getMark("rfenghou__yingzhi-tmp")[1]
      if self.interaction.data == "rfenghou__yingzhi1" then
        return #selected == n
      else
        return #selected == n // 2
      end
    end
  end,
}
local rfenghou__chezhiAGSkill = fk.CreateActiveSkill{  --AGFilled数据赋值比移牌晚了几行，只能重写AG
  name = "rfenghou__chezhi_amazing_grace_skill",
  prompt = "#amazing_grace_skill",
  can_use = Util.GlobalCanUse,
  on_use = Util.GlobalOnUse,
  mod_target_filter = Util.TrueFunc,
  on_action = function(self, room, use, finished)
    if not finished then
      local toDisplay = room:getNCards(#TargetGroup:getRealTargets(use.tos))
      use.extra_data = use.extra_data or {}
      use.extra_data.AGFilled = toDisplay
      room:moveCards({
        ids = toDisplay,
        toArea = Card.Processing,
        moveReason = fk.ReasonPut,
        proposer = use.from,
      })
      toDisplay = use.extra_data.AGFilled
      table.forEach(room.players, function(p)
        room:fillAG(p, toDisplay)
      end)

      use.extra_data.AGResult = {}
    else
      if use.extra_data and use.extra_data.AGFilled then
        table.forEach(room.players, function(p)
          room:closeAG(p)
        end)

        local toDiscard = table.filter(use.extra_data.AGFilled, function(id)
          return room:getCardArea(id) == Card.Processing
        end)

        if #toDiscard > 0 then
          room:moveCards({
            ids = toDiscard,
            toArea = Card.DiscardPile,
            moveReason = fk.ReasonPutIntoDiscardPile,
          })
        end
      end

      use.extra_data.AGFilled = nil
    end
  end,
  on_effect = function(self, room, effect)
    local to = room:getPlayerById(effect.to)
    if not (effect.extra_data and effect.extra_data.AGFilled and #effect.extra_data.AGFilled > 0) then
      return
    end

    local chosen = room:askForAG(to, effect.extra_data.AGFilled, false, "amazing_grace_skill")
    room:takeAG(to, chosen, room.players)
    table.insert(effect.extra_data.AGResult, {effect.to, chosen})
    room:moveCardTo(chosen, Card.PlayerHand, effect.to, fk.ReasonPrey, "amazing_grace_skill", nil, true, effect.to)
    table.removeOne(effect.extra_data.AGFilled, chosen)
  end
}
Fk:addSkill(rfenghou__chezhiAGSkill)
rfenghou__chezhiAGSkill.cardSkill = true
local chezhi = fk.CreateTriggerSkill{
  name = "rfenghou__chezhi$",
  anim_type = "special",
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self) and
      table.find(player.room:getOtherPlayers(player), function (p)
        return p.kingdom == "qin" and not p:isNude()
      end) then
      local effect_event = player.room.logic:getCurrentEvent():findParent(GameEvent.CardEffect)
      if effect_event then
        local use = effect_event.data[1]
        if use.card.name == "hanqing__enemy_at_the_gates" and use.from == player.id and use.extra_data then
          for _, move in ipairs(data) do
            if move.toArea == Card.Processing and move.moveReason == fk.ReasonJustMove then
              for _, info in ipairs(move.moveInfo) do
                if table.contains(use.extra_data.HQenemy_at_the_gates, info.cardId) then
                  return true
                end
              end
            end
          end
        end
      end
      local use_event = player.room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
      if use_event then
        local use = use_event.data[1]
        if use.card.trueName == "amazing_grace" and use.from == player.id and use.extra_data then
          for _, move in ipairs(data) do
            if move.toArea == Card.Processing and move.moveReason == fk.ReasonPut then
              for _, info in ipairs(move.moveInfo) do
                if table.contains(use.extra_data.AGFilled, info.cardId) then
                  return true
                end
              end
            end
          end
        end
      end
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local name, cards = "", {}
    local to = 0
    local effect_event = room.logic:getCurrentEvent():findParent(GameEvent.CardEffect)
    if effect_event then
      local use = effect_event.data[1]
      if use.card.name == "hanqing__enemy_at_the_gates" and use.from == player.id and use.extra_data then
        name = "hanqing__enemy_at_the_gates"
        to = use.to
        for _, move in ipairs(data) do
          if move.toArea == Card.Processing and move.moveReason == fk.ReasonJustMove then
            for _, info in ipairs(move.moveInfo) do
              if table.contains(use.extra_data.HQenemy_at_the_gates, info.cardId) then
                table.insertIfNeed(cards, info.cardId)
              end
            end
          end
        end
      end
    end
    local use_event = room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
    if use_event then
      local use = use_event.data[1]
      if use.card.trueName == "amazing_grace" and use.from == player.id and use.extra_data then
        name = "amazing_grace"
        for _, move in ipairs(data) do
          if move.toArea == Card.Processing and move.moveReason == fk.ReasonPut then
            for _, info in ipairs(move.moveInfo) do
              if table.contains(use.extra_data.AGFilled, info.cardId) then
                table.insertIfNeed(cards, info.cardId)
              end
            end
          end
        end
      end
    end
    for _, p in ipairs(room:getOtherPlayers(player)) do
      cards = table.filter(cards, function (id)
        return room:getCardArea(id) == Card.Processing
      end)
      if #cards == 0 then break end
      if p.kingdom == "qin" and not p.dead and not p:isNude() then
        local cards1, cards2 = {}, {}
        for _, id in ipairs(cards) do
          if Fk:getCardById(id).trueName == "slash" then
            table.insert(cards2, id)
          else
            table.insert(cards1, id)
          end
        end
        local choices = {}
        if #cards1 > 1 and not p:isKongcheng() then
          table.insert(choices, "rfenghou__chezhi1")
        end
        if #cards2 > 0 and #p:getCardIds("he") > 1 then
          table.insert(choices, "rfenghou__chezhi2")
        end
        if #choices > 0 then
          room:setPlayerMark(p, "rfenghou__chezhi-tmp", choices)
          local prompt
          if name == "hanqing__enemy_at_the_gates" then
            prompt = "#rfenghou__chezhi1-invoke:"..player.id..":"..to
          elseif name == "amazing_grace" then
            prompt = "#rfenghou__chezhi2-invoke:"..player.id
          end
          local success, dat = room:askForUseActiveSkill(p, "rfenghou__chezhi_active", prompt, true)
          room:setPlayerMark(p, "rfenghou__chezhi-tmp", 0)
          if success and dat then
            local ids
            if dat.interaction == "rfenghou__chezhi1" then
              ids = U.askforChooseCardsAndChoice(p, cards1, {"OK"}, self.name, "#rfenghou__chezhi1-prey", nil, 2, 2, cards)
              table.removeOne(cards, ids[1])
              table.removeOne(cards, ids[2])
              table.insert(cards, dat.cards[1])
            else
              ids = U.askforChooseCardsAndChoice(p, cards2, {"OK"}, self.name, "#rfenghou__chezhi2-prey", nil, 1, 1, cards)
              table.removeOne(cards, ids[1])
              table.insert(cards, dat.cards[1])
              table.insert(cards, dat.cards[2])
            end
            room:moveCards(
              {
                ids = dat.cards,
                from = p.id,
                toArea = Card.Processing,
                moveReason = fk.ReasonExchange,
                proposer = p.id,
                skillName = self.name,
                moveVisible = true,
              },
              {
                ids = ids,
                to = p.id,
                toArea = Card.PlayerHand,
                moveReason = fk.ReasonExchange,
                proposer = p.id,
                skillName = self.name,
                moveVisible = true,
              }
            )
          end
        end
      end
    end
    if name == "hanqing__enemy_at_the_gates" then
      if effect_event then
        local use = effect_event.data[1]
        if use.card.name == "hanqing__enemy_at_the_gates" and use.from == player.id and use.extra_data then
          use.extra_data.HQenemy_at_the_gates = cards
        end
      end
    elseif name == "amazing_grace" then
      if use_event then
        local use = use_event.data[1]
        if use.card.trueName == "amazing_grace" and use.from == player.id and use.extra_data then
          use.extra_data.AGFilled = cards
        end
      end
    end
  end,

  refresh_events = {fk.CardUsing},  --在使用事件牌生效前的最后一个时机改掉card.skill
  can_refresh = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and data.card.trueName == "amazing_grace"
  end,
  on_refresh = function(self, event, target, player, data)
    local new_card = Fk:cloneCard("amazing_grace", data.card.suit, data.card.number)
    local c = table.simpleClone(data.card)
    for k, v in pairs(c) do
      if new_card[k] == nil then
        new_card[k] = v
      end
    end
    if data.card:isVirtual() then
      new_card.subcards = data.card.subcards
    else
      new_card.id = data.card.id
    end
    new_card.skillNames = data.card.skillNames
    new_card.skill = rfenghou__chezhiAGSkill
    data.card = new_card
    player.room.logic:getCurrentEvent().data[1].card = new_card
  end,
}
local chezhi_active = fk.CreateActiveSkill{
  name = "rfenghou__chezhi_active",
  min_card_num = 1,
  max_card_num = 2,
  interaction = function ()
    local all_choices = {"rfenghou__chezhi1", "rfenghou__chezhi2"}
    local choices = Self:getMark("rfenghou__chezhi-tmp")
    return UI.ComboBox {choices = choices, all_choices = all_choices}
  end,
  card_filter = function (self, to_select, selected)
    if self.interaction.data == "rfenghou__chezhi1" then
      return #selected == 0 and Fk:getCardById(to_select).trueName == "slash"
    elseif self.interaction.data == "rfenghou__chezhi2" then
      return #selected < 2
    end
  end,
  feasible = function (self, selected, selected_cards)
    if self.interaction.data == "rfenghou__chezhi1" then
      return #selected_cards == 1
    else
      return #selected_cards == 2
    end
  end,
}

hezhi:addRelatedSkill(hezhi_prohibit)
hezhi:addRelatedSkill(hezhi_delay)
Fk:addSkill(yingzhi_active)
Fk:addSkill(chezhi_active)
fujian:addSkill(hezhi)
fujian:addSkill(yingzhi)
fujian:addSkill(chezhi)
Fk:loadTranslationTable{
  ["rfenghou__fujian"] = "苻坚",
  ["#rfenghou__fujian"] = "辟目垂旒",
  ["designer:rfenghou__fujian"] = "鱼竿",
  ["illustrator:rfenghou__fujian"] = "率土之滨",

  ["rfenghou__hezhi"] = "合志",
  [":rfenghou__hezhi"] = "出牌阶段限一次，你可以视为对其他角色使用【兵临城下】或【五谷丰登】，然后若有亮出牌因此置入弃牌堆，你弃置所有手牌获得之，"..
  "否则你视为使用另一种牌。",
  ["rfenghou__yingzhi"] = "盈制",
  [":rfenghou__yingzhi"] = "每回合限一次，当你使用基本牌或普通锦囊牌指定目标后，若你的手牌数等于手牌上限，你可以为之增加一倍目标或"..
  "令之对一半目标无效（向下取整）。",
  ["rfenghou__chezhi"] = "掣治",
  [":rfenghou__chezhi"] = "主公技，当你使用【兵临城下】或【五谷丰登】亮出牌后，其他秦势力角色可以用一张【杀】替换其中的两张非【杀】牌或"..
  "用两张牌替换其中的一张【杀】。",
  ["#rfenghou__hezhi"] = "合志：视为对其他角色使用【兵临城下】或【五谷丰登】，根据是否有亮出牌置入弃牌堆执行额外效果",
  ["#rfenghou__hezhi_delay"] = "合志",
  ["#rfenghou__hezhi-use"] = "合志：请视为使用【%arg】",
  ["#rfenghou__yingzhi-choose"] = "盈制：你可以为%arg增加一倍目标，或对一半目标无效",
  ["rfenghou__yingzhi_active"] = "盈制",
  ["rfenghou__yingzhi1"] = "增加一倍目标",
  ["rfenghou__yingzhi2"] = "对一半目标无效",
  ["rfenghou__chezhi_active"] = "掣治",
  ["#rfenghou__chezhi1-invoke"] = "掣治：%src 对 %dest 使用【兵临城下】，是否交换亮出牌？（选择你用来交换的牌）",
  ["#rfenghou__chezhi2-invoke"] = "掣治：%src 使用【五谷丰登】，是否交换亮出牌？（选择你用来交换的牌）",
  ["rfenghou__chezhi1"] = "一张【杀】替换其中两张非【杀】牌",
  ["rfenghou__chezhi2"] = "两张牌替换其中一张【杀】",
  ["#rfenghou__chezhi1-prey"] = "掣治：选择获得的两张非【杀】牌",
  ["#rfenghou__chezhi2-prey"] = "掣治：选择获得的一张【杀】",
}

local jiumoluoshi = General(extension, "rfenghou__jiumoluoshi", "qin", 3)
local haobian = fk.CreateTriggerSkill{
  name = "rfenghou__haobian",
  anim_type = "control",
  frequency = Skill.Compulsory,
  events = {fk.BeforeDrawCard},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    while true do
      local cards = room:getNCards(2 * data.num)
      room:moveCardTo(cards, Card.Processing, nil, fk.ReasonJustMove, self.name, nil, true, player.id)
      room:delay(1000)
      local id = 0
      for i = #cards, 1, -1 do
        if Fk:getCardById(cards[i]).type == Card.TypeBasic then
          id = cards[i]
          break
        end
      end
      if id == 0 then
        room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonJustMove)
        break
      end
      room:moveCardTo(id, Card.PlayerHand, player, fk.ReasonJustMove, self.name, nil, true, player.id)
      if player.dead then
        cards = table.filter(cards, function (c)
          return room:getCardArea(c) == Card.Processing
        end)
        if #cards > 0 then
          room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonJustMove)
        end
        break
      end
      local card = Fk:getCardById(id)
      if card.trueName == "slash" or #table.filter(cards, function (c)
        return Fk:getCardById(c).type == Card.TypeBasic
      end) == 1 then
        if not player:prohibitUse(card) and not player:isProhibited(player, card) and
          (player:canUseTo(card, player) or card.skill.target_num) and
          room:askForSkillInvoke(player, self.name, nil, "#rfenghou__haobian-use:::"..card:toLogString()) then
          room:useCard{
            from = player.id,
            tos = {{player.id}},
            card = card,
            extraUse = true,
          }
          cards = table.filter(cards, function (c)
            return room:getCardArea(c) == Card.Processing
          end)
          if #cards > 0 then
            room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonJustMove)
          end
          break
        else
          cards = table.filter(cards, function (c)
            return room:getCardArea(c) == Card.Processing
          end)
          if #cards > 0 then
            room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonJustMove)
          end
        end
      else
        cards = table.filter(cards, function (c)
          return room:getCardArea(c) == Card.Processing
        end)
        if #cards > 0 then
          room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonJustMove)
        end
        break
      end
    end
    return true
  end,
}
local ningcheng = fk.CreateTriggerSkill{
  name = "rfenghou__ningcheng",
  anim_type = "masochism",
  events = {fk.Damaged},
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(self) and #player.room:getBanner("@$CenterArea") > 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local success, dat = room:askForUseActiveSkill(player, "rfenghou__ningcheng_active",
      "#rfenghou__ningcheng-invoke", true, {expand_pile = room:getBanner("@$CenterArea")})
    if success and dat then
      self.cost_data = {tos = dat.targets, cards = dat.cards, choice = dat.interaction}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(self.cost_data.tos[1])
    local card = Fk:getCardById(self.cost_data.cards[1])
    local yes = true
    if table.find(room.alive_players, function (p)
      return table.find(p:getCardIds("ej"), function (id)
        return card:compareSuitWith(Fk:getCardById(id))
      end)
    end) then
      yes = false
    end
    if self.cost_data.choice == "rfenghou__ningcheng_put" then
      if card.type == Card.TypeEquip then
        room:moveCardIntoEquip(to, card.id, self.name, false, player)
      else
        room:moveCardTo(card, Card.PlayerJudge, to, fk.ReasonPut, self.name, nil, true, player.id)
      end
    else
      RUtil.premeditate(to, card, self.name, player.id)
    end
    if not player.dead and yes then
      player:drawCards(1, self.name)
    end
  end,
}
local ningcheng_active = fk.CreateActiveSkill{
  name = "rfenghou__ningcheng_active",
  card_num = 1,
  target_num = 1,
  interaction = UI.ComboBox {choices = {"rfenghou__ningcheng_put", "rfenghou__ningcheng_premeditate"}},
  card_filter = function (self, to_select, selected)
    if #selected == 0 and table.contains(Fk:currentRoom():getBanner("@$CenterArea"), to_select) then
      if self.interaction.data == "rfenghou__ningcheng_put" then
        local card = Fk:getCardById(to_select)
        return card.type == Card.TypeEquip or card.sub_type == Card.SubtypeDelayedTrick
      elseif self.interaction.data == "rfenghou__ningcheng_premeditate" then
        return true
      end
    end
  end,
  target_filter = function (self, to_select, selected, selected_cards)
    if #selected == 0 and #selected_cards == 1 then
      if self.interaction.data == "rfenghou__ningcheng_put" then
        local card = Fk:getCardById(selected_cards[1])
        local target = Fk:currentRoom():getPlayerById(to_select)
        if card.type == Card.TypeEquip then
          return target:hasEmptyEquipSlot(card.sub_type)
        elseif card.sub_type == Card.SubtypeDelayedTrick then
          return not target:hasDelayedTrick(card.name)
        end
      elseif self.interaction.data == "rfenghou__ningcheng_premeditate" then
        return true
      end
    end
  end,
}
Fk:addSkill(ningcheng_active)
ningcheng.CenterArea = true
jiumoluoshi:addSkill(haobian)
jiumoluoshi:addSkill(ningcheng)
Fk:loadTranslationTable{
  ["rfenghou__jiumoluoshi"] = "鸠摩罗什",
  ["#rfenghou__jiumoluoshi"] = "沙中之火",
  ["designer:rfenghou__jiumoluoshi"] = "三秋",
  ["illustrator:rfenghou__jiumoluoshi"] = "卡扑文化",

  ["rfenghou__haobian"] = "皓编",
  [":rfenghou__haobian"] = "锁定技，当你摸牌时，改为亮出牌堆顶两倍的牌，你获得其中最后一张基本牌，若此牌为【杀】或为其中唯一的基本牌，"..
  "你须选择对自己使用此牌或重复此流程。",
  ["rfenghou__ningcheng"] = "泞程",
  [":rfenghou__ningcheng"] = "当你受到伤害后，你可以将中央区一张牌置于场上（置入装备区、判定区或蓄谋）；若为场上没有的花色，你摸一张牌。",
  ["#rfenghou__haobian-use"] = "皓编：点“确定”对自己使用%arg，或点“取消”重复此流程",
  ["rfenghou__ningcheng_active"] = "泞程",
  ["#rfenghou__ningcheng-invoke"] = "泞程：你可以将中央区一张牌置于场上，若为场上没有的花色，你摸一张牌",
  ["rfenghou__ningcheng_put"] = "置于场上",
  ["rfenghou__ningcheng_premeditate"] = "蓄谋",
}

local yaochang = General(extension, "rfenghou__yaochang", "qin", 4)
local sichan = fk.CreateTriggerSkill{
  name = "rfenghou__sichan",
  anim_type = "switch",
  events = {fk.TurnEnd},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and
      (#player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
        return e.data[1].from == player.id
      end, Player.HistoryTurn) > 0 or
      #player.room.logic:getEventsOfScope(GameEvent.RespondCard, 1, function(e)
        return e.data[1].from == player.id
      end, Player.HistoryTurn) > 0) and
      table.find({1, 2, 3}, function (i)
        return player:getMark("@!rfenghou"..i) > 0 and not table.contains(player:getTableMark("rfenghou__sichan-round"), i)
      end)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local prompt = ""
    for i = 1, 3, 1 do
      if player:getMark("@!rfenghou"..i) > 0 then
        prompt = "#rfenghou__sichan"..i.."-invoke"
        if i < 3 and i + player:getMark("rfenghou__sichan_removed") == 3 then
          prompt = prompt.."2"
        end
        break
      end
    end
    local to = room:askForChoosePlayers(player, table.map(room.alive_players, Util.IdMapper), 1, 1, prompt, self.name, true)
    if #to > 0 then
      self.cost_data = {tos = to, choice = tonumber(prompt[18])}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(self.cost_data.tos[1])
    local n = self.cost_data.choice
    room:addTableMark(player, "rfenghou__sichan-round", n)
    to:drawCards(n, self.name)
    if n + player:getMark("rfenghou__sichan_removed") == 3 then
      if not to.dead then
        room:askForDiscard(to, 3, 3, true, self.name, false)
      end
      if player.dead then return end
      if player:getMark("rfenghou__sichan_removed") < 2 then
        room:addPlayerMark(player, "rfenghou__sichan_removed", 1)
        player:drawCards(n, self.name)
      end
    end
    if player.dead then return end
    RUtil.RfenghouSwitch(player, 3 - player:getMark("rfenghou__sichan_removed"))
  end,

  refresh_events = {fk.EventAcquireSkill},
  can_refresh = function (self, event, target, player, data)
    return target == player and data == self
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(player, "@!rfenghou1", 1)
  end,
}
local xuanwei = fk.CreateViewAsSkill{
  name = "rfenghou__xuanwei$",
  anim_type = "control",
  frequency = Skill.Limited,
  pattern = "nullification",
  prompt = "#rfenghou__xuanwei",
  card_filter = Util.FalseFunc,
  view_as = function(self, cards)
    local card = Fk:cloneCard("nullification")
    card.skillName = self.name
    return card
  end,
  before_use = function (self, player, use)
    local room = player.room
    local skills = table.map(table.filter(player.player_skills, function(s)
      return s:isPlayerSkill(player) and s.visible and table.contains({"rfenghou__sichan", "rfenghou__xuanwei"}, s.name)
    end), function(s)
      return s.name
    end)
    local choice = room:askForChoice(player, skills, self.name, "#rfenghou__xuanwei-choice", true)
    room:addTableMark(player, self.name, choice)
    room:handleAddLoseSkills(player, "-"..choice, nil, true, false)
  end,
  enabled_at_response = function (self, player, response)
    return not response and (response == nil or player:getMark("rfenghou__xuanwei_activated") > 0) and
      player:usedSkillTimes(self.name, Player.HistoryGame) == 0
  end,
}
local xuanwei_trigger = fk.CreateTriggerSkill{
  name = "#rfenghou__xuanwei_trigger",
  anim_type = "special",
  events = {fk.Damaged},
  can_trigger = function (self, event, target, player, data)
    return target == player and not player.dead and player:getMark("rfenghou__xuanwei") ~= 0
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local skills = table.filter(player:getMark("rfenghou__xuanwei"), function(s)
      return not player:hasSkill(s, true)
    end)
    room:setPlayerMark(player, "rfenghou__xuanwei", 0)
    if #skills > 0 then
      for _, skill in ipairs(skills) do
        if skill == "rfenghou__sichan" then
          room:setPlayerMark(player, "rfenghou__sichan_removed", 0)
          room:setPlayerMark(player, "rfenghou__sichan-round", 0)
          room:setPlayerMark(player, "@!rfenghou1", 1)
          room:setPlayerMark(player, "@!rfenghou2", 0)
          room:setPlayerMark(player, "@!rfenghou3", 0)
        elseif skill == "rfenghou__xuanwei" then
          player:setSkillUseHistory("rfenghou__xuanwei", 0, Player.HistoryGame)
        end
      end
      room:handleAddLoseSkills(player, skills, nil, true, false)
    end
  end,

  refresh_events = {fk.HandleAskForPlayCard},
  can_refresh = function(self, event, target, player, data)
    if data.afterRequest and (data.extra_data or {}).rfenghou__xuanwei then
      return player:getMark("rfenghou__xuanwei_activated") > 0
    end

    return player:hasSkill(xuanwei) and
      data.eventData and data.eventData.to and player.room:getPlayerById(data.eventData.to).kingdom == "qin" and
      Exppattern:Parse(data.pattern):match(Fk:cloneCard("nullification"))
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    if data.afterRequest then
      room:setPlayerMark(player, "rfenghou__xuanwei_activated", 0)
    else
      room:setPlayerMark(player, "rfenghou__xuanwei_activated", 1)
      data.extra_data = data.extra_data or {}
      data.extra_data.rfenghou__xuanwei = true
    end
  end,
}
xuanwei:addRelatedSkill(xuanwei_trigger)
yaochang:addSkill(sichan)
yaochang:addSkill(xuanwei)
Fk:loadTranslationTable{
  ["rfenghou__yaochang"] = "姚苌",
  ["#rfenghou__yaochang"] = "腾骧建位",
  ["designer:rfenghou__yaochang"] = "折翼",
  ["illustrator:rfenghou__yaochang"] = "卡扑文化",
  ["cv:rfenghou__yaochang"] = "折翼",

  ["rfenghou__sichan"] = "斯缠",
  [":rfenghou__sichan"] = "转换技，每轮每项限一次，当你使用或打出过牌的回合结束时，你可以令一名角色摸①一②二③三张牌。若此次发动为最后一项，"..
  "该角色弃置三张牌，然后若转换项不唯一，你执行并移除此项。",
  ["rfenghou__xuanwei"] = "宣慰",
  [":rfenghou__xuanwei"] = "主公技，限定技，当锦囊牌对秦势力角色生效前，你可以失去此武将牌上的一个技能，视为使用【无懈可击】；直到你下次受到伤害，"..
  "恢复并复原失去的技能。",
  ["#rfenghou__sichan1-invoke"] = "斯缠：你可以令一名角色摸一张牌",
  ["#rfenghou__sichan1-invoke2"] = "斯缠：你可以令一名角色摸一张牌并弃置三张牌",
  ["#rfenghou__sichan2-invoke"] = "斯缠：你可以令一名角色摸两张牌",
  ["#rfenghou__sichan2-invoke2"] = "斯缠：你可以令一名角色摸两张牌并弃置三张牌",
  ["#rfenghou__sichan3-invoke"] = "斯缠：你可以令一名角色摸三张牌并弃置三张牌",
  ["#rfenghou__xuanwei"] = "宣慰：你可以失去一个技能直到你下次受到伤害，视为使用【无懈可击】！",
  ["#rfenghou__xuanwei-choice"] = "宣慰：选择失去一个技能直到你下次受到伤害",
  ["#rfenghou__xuanwei_trigger"] = "宣慰",

  ["$rfenghou__sichan1"] = "盛怒之师难破，盛怒之势可挫。",
  ["$rfenghou__sichan2"] = "归师勿遏，穷寇勿迫。",
  ["$rfenghou__sichan3"] = "急攻则败散其众，缓之则其谋得成。",
  ["$rfenghou__xuanwei1"] = "陛下命臣以龙骧建业，臣领命，不敢违。",
  ["$rfenghou__xuanwei2"] = "吾不及亡兄有四，幸算中群贤之能。",
  ["~rfenghou__yaochang"] = "兄襄之过，非臣之罪，陛下？陛下！",
}

return extension
